<?php
$this->headTitle('Thông tin tài khoản '.$this->gameCheck['gameName'].' ('.$this->gameCheck['gameId'].')', 'append');
?>

<div class="grid">
    <div class="breadcrumbs">
        <a class="item-1 loading" href="/index">Trang chủ CI</a> › 
        <a class="item-2 loading" href="/accountinfo/index/game/<?php echo $this->gameCheck['gameId'];?>"><?php echo $this->gameCheck['gameName'],' (',$this->gameCheck['gameId'],')';?></a> › 
        <span class="blue">Thông tin tài khoản</span>
        <div class="clear-both"></div>
    </div>
    <?php if(isset($this->repair)){ ?>
            <?php
                if($this->flag == 'success')
                    echo '<div class="notification success">',$this->mess,'</div>';
                elseif($this->flag == 'alert')
                    echo '<div class="notification alert">',$this->mess,'</div>';
                else
                    echo '<div class="notification error">',$this->mess,'</div>';
            ?>
    <?php }else{ ?>
    <div class="flugin">
        <div class="search">
            <div class="form">
                <div id="tabs-search">
                    <ul class="tabs-menu">
                        <li class="active" id="tabs-1"><span>Tìm kiếm</span></li>
                    </ul>
                    <div class="tabs tabs-1">
                        <form name="fSeachDate" action="/accountinfo/index/game/<?php echo $this->gameCheck['gameId'];?>" method="GET" onsubmit="return checkSearchTransaction();">
                            <div class="name">
                                <label>Tài khoản</label>
                                <input type="text" name="username" value="<?php echo (isset($this->username)) ? $this->username : '';?>"/>
                            </div>
							<?php if(!isset($this->configGame->transaction->agent_id) || (isset($this->configGame->transaction->agent_id) && $this->configGame->transaction->agent_id == 1)){ ?>
                            <label>Channel</label>
                            <select name="channel" class="channel" style="width: 120px;float: left;">
                                <option value="0">Vui lòng chọn</option>
                                <?php 
                                    $listChannel = '';
                                    foreach($this->arrChannel as $key=>$channel){
                                        echo '<option value="',$key,'"',(isset($this->channel) && $this->channel == $key) ? 'selected="selected"' : '','>',$channel['name'],'</option>';
                                        $listChannel .= " {$key}";
                                    } 
                                ?>
                            </select>
							<?php } ?>
                            <div class="submit">
                                <input type="submit" name="bntSubmit" value="Tìm" class="loading"/>
                            </div>
                            <div class="clear-both"></div>
                        </form>
                    </div>
                    <div class="clear-both"></div>
                </div>
                <div class="clear-both"></div>
            </div>
            <div class="clear-both"></div>
            <script type="text/javascript">
                function checkSearchTransaction(){
                    var username = document.fSeachDate.username.value;
                    if (username==null || username=="")
                    {
                        alert("Vui lòng nhập username!");
                        $('.loading-please-wait').css('display','none');
                        return false;
                    }
                    var channel = document.fSeachDate.channel.value;
                    if (channel==null || channel=="" || channel=="0")
                    {
                        alert("Vui lòng nhập channel!");
                        $('.loading-please-wait').css('display','none');
                        return false;
                    }
                    return true;
                }
            </script>
        </div>
        <?php
            if($this->mess){
                if($this->flag == 'success')
                    echo '<div class="notification success">',$this->mess,'</div>';
                elseif($this->flag == 'alert')
                    echo '<div class="notification alert">',$this->mess,'</div>';
                else
                    echo '<div class="notification error">',$this->mess,'</div>';
            }
        ?>
        <?php if($this->dataUser){ ?>
        <div class="table">
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <thead>
                    <tr>
                        <td class="column">STT</td>
                        <td class="column">Channel</td>
                        <td class="column">Username</td>
                        <td class="column">SDT</td>
                        <td class="column">Email</td>
                    </tr>
                </thead>
                <tbody>
                    <?php 
                        $stt = 1;
                        foreach($this->dataUser as $key=>$row){
                            foreach($row as $key2 => $row2){
                                if(!isset($this->dataUser[$key][$this->username]['mobile'])){
                                    continue;
                                }
                                echo '<tr>';
                                echo '<td class="text-align-center">',$stt,'</td>';
                                echo '<td class="text-align-left">',$key,'</td>';
                                echo '<td class="text-align-left">',$this->username,'</td>';
                                echo '<td class="text-align-left">',$this->dataUser[$key][$this->username]['mobile'],'</td>';
                                echo '<td class="text-align-left">',$this->dataUser[$key][$this->username]['email'],'</td>';
                                echo '</tr>';
                                ++$stt; 
                            }
                        }
                    ?>
                </tbody>
            </table>
        </div>
        <?php } ?>
    </div>
    <?php } ?>
</div>
